<div class="modal fade" id="modal-add">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">添加课程</h4>
            </div>
            <div class="modal-body">
                <form action="{{route('lessons_add')}}" method="post" role="form" id="lessons_add"
                      enctype="multipart/form-data">
                    {{csrf_field()}}
                    <div class="form-group">
                        <label for="title" class="control-label">标题:</label>
                        <div class="">
                            <input type="text" name="title" id="title" class="form-control" value=""
                                   required="required">
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <br>

                    <div class="form-group">
                        <label for="video_url" class="control-label">视频链接地址:</label>
                        <div class="">
                            <input type="text" name="video_url" id="video_url" class="form-control" value=""
                                   required="required">
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <br>

                    <div class="form-group">
                        <label for="introduce" class="control-label">视频介绍:</label>
                        {{--<div class="col-sm-10">--}}
                        {{--<textarea name="introduce" id="introduce"--}}
                        {{--style="width: 100%;resize: none;height: 300px"></textarea>--}}
                        {{--</div>--}}

                        <input type="hidden" id="introduce_add" name="introduce">
                        <div id="editor"></div>
                    </div>
                    <div class="clearfix"></div>
                    <br>

                    <div class="form-group">
                        <label for="video_img" class=" control-label">视频封面</label>
                        <div class="">
                            <input type="text" name="video_img" id="video_img" class="form-control" value=""
                                   required="required">
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <br>

                    <div class="form-group">
                        <div class="form-group">
                            <label for="lessons_category" class=" control-label">课程分类</label>
                            <div class="">
                                <select name="lessons_category_id" id="lessons_category" class="form-control">
                                    @foreach($category as $k=>$v)
                                        <option value="{{$v->id}}">{{$v->category_name}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <br>

                    <div class="form-group">
                        <label for="lessons_teacher" class=" control-label">课程老师</label>
                        <div class="">
                            <input type="text" name="lessons_teacher" id="lessons_teacher" class="form-control" value=""
                                   required="required">
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <br>

                    <div class="btn-group col-md-12">
                        <button type="submit" id="send" class="btn btn-danger col-md-12">提交</button>
                    </div>
                    <div class="clearfix"></div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="{{asset('admin/js/wangEditor.min.js')}}"></script>
<script>
    var E = window.wangEditor
    var editor = new E('#editor')
    editor.customConfig.menus = [
        'head',  // 标题
        'bold',  // 粗体
        'italic',  // 斜体
        'underline',  // 下划线
        'strikeThrough',  // 删除线
        'foreColor',  // 文字颜色
        'backColor',  // 背景颜色
        'link',  // 插入链接
        'list',  // 列表
        'justify',  // 对齐方式
        'quote',  // 引用
        'emoticon',  // 表情
    ];
    editor.customConfig.onchange = function (html) {
        $('#introduce_add').val(editor.txt.text());
    }
    editor.create()

    $(function () {
//        $('#send').on('click', function () {
//            html = $('.w-e-text').text();
//            console.log(html);
//            $('#introduce_add').val(html);
//            $('#lessons_add').submit();
//        })
    })

</script>